#include <iostream>
#include <thread>
#include <mutex>

std::mutex mtx;
int m = 0;


void Test()
{   
    for (int i = 0; i < 10000000; ++i)
    {   
        mtx.lock();
        m++;
        m--;
        mtx.unlock();
    }
}

int main()
{
    std::thread t1(Test);
    std::thread t2(Test);
    t1.join();
    t2.join();
    std::cout << m << std::endl;
    return 0;
}